package DAO;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class ConsultaLogin {
  public ConsultaLogin() {
  }
  
  
  
  public boolean Login(String usuario, String password)
  {
    Conexion conexion = new Conexion();
    boolean retorno = false;
    Connection conex;
    try {
      conex = conexion.getConnection();
      PreparedStatement ps = null;
      ResultSet rs = null;

      ps = 
      conex.prepareStatement("select nickname, clave from Staff where nickname = ? and clave = ?");      
      
      ps.setString(1, usuario);
      ps.setString(2, password);
      
      rs = ps.executeQuery();
      
      
      while(rs.next()){
        System.out.println(rs.getString("nickname"));
        retorno = true;
      }
        
      
      
    } catch (SQLException e) {
    }
    
    return retorno;
    
    
  }
}
